package com.winchain.chainbill.bill.biz.discount.controller;

import com.shell.bee.base.annotation.Logging;
import com.shell.bee.entity.mvc.RetMsg;
import com.shell.bee.persistence.model.PageLimit;
import com.winchain.chainbill.bill.base.po.CbDctQt;
import com.winchain.chainbill.bill.biz.discount.service.BillDctQtService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BillDctQtController {
	@Autowired
	private BillDctQtService billDctQtService;

	@RequestMapping
	@ResponseBody
	@Logging(module = "��������", methods = "������������")
	public List<CbDctQt> selectDctQtList(PageLimit limit, CbDctQt dctQt) {
		return this.billDctQtService.selectDctQtList(limit, dctQt);
	}

	@RequestMapping
	@ResponseBody
	@Logging(module = "��������", methods = "��������������������")
	public List<CbDctQt> selectFinDctQtList(PageLimit limit, CbDctQt dctQt) {
		return this.billDctQtService.selectFinDctQtList(limit, dctQt);
	}

	@RequestMapping
	@ResponseBody
	@Logging(module = "��������", methods = "������������������������")
	public List<String> selectFinIdsByGrpId(String grpId) {
		return this.billDctQtService.selectFinIdsByGrpId(grpId);
	}

	@RequestMapping
	@ResponseBody
	@Logging(module = "��������", methods = "����������������")
	public RetMsg saveDctQt(@RequestBody List<CbDctQt> cbDctQts) throws Exception {
		String msg = this.billDctQtService.saveDctQt(cbDctQts);
		if (msg != null) {
			return new RetMsg("error", true, "����������" + msg);
		}
		return new RetMsg("success", false, "��������");
	}

	@RequestMapping
	@ResponseBody
	@Logging(module = "��������", methods = "����������������")
	public RetMsg updateDctQt(CbDctQt dctQt) {
		String msg = this.billDctQtService.updateDctQt(dctQt);
		if (msg != null) {
			return new RetMsg("error", true, "��������" + msg);
		}
		return new RetMsg("success", false, "��������");
	}
}
